package zoo.productqnareplyboard.admin.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import zoo.productqnareplyboard.admin.domain.AdminProductReplyBoardCommand;
import zoo.productqnareplyboard.admin.domain.AdminQboardCommand;

public class AdminQnAProductReplyBoardDaoImpl extends SqlSessionDaoSupport implements AdminQnAProductReplyBoardDao{

	@Override
	public int getQnaRowCount(Map<String, Object> map) {
		return (Integer)getSqlSession().selectOne("aSelectQnaCount",map);
	}

	@Override
	public List<AdminQboardCommand> qnalist(Map<String, Object> map) {
		List<AdminQboardCommand> qnalist = getSqlSession().selectList("aSelectQnaList",map);
		return qnalist;
	}

	@Override
	public AdminQboardCommand selectQBoard(Integer bq_num) {
		AdminQboardCommand qboard = getSqlSession().selectOne("detailQnaBoard",bq_num);
		return qboard;
	}

	@Override
	public void insertQnaBoard(AdminProductReplyBoardCommand board) {
		getSqlSession().insert("insertQnaReply", board);
	}

	@Override
	public void checkStatua(Integer bq_num) {
		getSqlSession().update("checkStatua",bq_num);
	}

	@Override
	public List<AdminProductReplyBoardCommand> selectQnaReply(Integer bq_num) {
		List<AdminProductReplyBoardCommand> reply = getSqlSession().selectList("qnaReply",bq_num);
		return reply;
	}

	@Override
	public void deleteRepBoard(Integer bqr_num) {
		getSqlSession().delete("deleteQRey",bqr_num);
	}

	@Override
	public void updateRepBoard(AdminProductReplyBoardCommand board) {
		getSqlSession().update("updateQrey",board);		
	}
}
